Skip to content

fix(openai): replay reasoning_content for Xiaomi MiMo tool calls#3350

Merged
amitksingh1490 merged 2 commits into
tailcallhq:mainfrom
joaohildebrandt:fix/xiaomi-mimo-reasoning-content
May 20, 2026
Merged

fix(openai): replay reasoning_content for Xiaomi MiMo tool calls#3350
amitksingh1490 merged 2 commits into
tailcallhq:mainfrom
joaohildebrandt:fix/xiaomi-mimo-reasoning-content

Conversation

@joaohildebrandt
Copy link
Copy Markdown
Contributor

Summary

Xiaomi MiMo API requires reasoning_content in follow-up requests when tool calls exist in conversation histo
ry. Forge's pipeline already handles this for DeepSeek, Fireworks, and Kimi via the ReasoningContent + DefaultReasoningContent transformers, but Xiaomi MiMo was left out, causing tool-based conversations to fail after the first tool call.

Fix

Three changes in crates/forge_app/src/dto/openai/transformers/pipeline.rs:

  1. ReasoningContent guard — added is_xiaomi_mimo_provider(provider) so that reasoning_details are converted to reasoning_content for MiMo, matching DeepSeek/Fireworks/Kimi behavior.

  2. DefaultReasoningContent guard — added the same check so that assistant messages without reasoning still get an empty reasoning_content field, which MiMo requires when tool calls are present.

  3. New helper — extracted is_xiaomi_mimo_provider() following the existing is_deepseek_provider() / is_zai_provider() pattern.

Testing

Two new tests added (mirroring existing DeepSeek tests):

  • test_xiaomi_mimo_provider_converts_reasoning_details_to_reasoning_contentreasoning_detailsreasoning_content conversion
  • test_xiaomi_mimo_provider_falls_back_to_empty_reasoning_content_when_none — verifies empty fallback when no reasoning is present

Full test suite: 702 passed, 0 failed. Clippy and fmt clean.

Related

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 17, 2026

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions Bot added the type: fix Iterations on existing features or infrastructure. label May 17, 2026
@amitksingh1490 amitksingh1490 enabled auto-merge (squash) May 20, 2026 03:23
@amitksingh1490 amitksingh1490 merged commit 6378198 into tailcallhq:main May 20, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: fix Iterations on existing features or infrastructure.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants